package context.event;

import beans.factory.BeanFactory;
import context.ApplicationEvent;
import context.ApplicationListener;

/**
 * @Description: TODO
 * @Author: Take-off
 * @Date: 2023/3/7 10:13 AM
 * @Param
 * @return
 * @Version: 1.0
 **/
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @SuppressWarnings("unchecked")
    @Override
    public void multicastEvent(final ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
